package 作业文件.接口作业.考试最后一题;

import java.util.*;

public class ArraylistGL {
    public static void main(String[] args) {
        ArrayList<Integer> list = new ArrayList<>();

        ArraylistGL arraylistGL = new ArraylistGL();
        System.out.println("去重排序以后的集合是"+arraylistGL.suiji(list));

    }
    //给集合去重
    public  Set  suiji(ArrayList<Integer> list){
        Random ra= new Random();
        for (int i = 0; i <10 ; i++) {
          int zhi=ra.nextInt(20);
            list.add(zhi);
            }
        System.out.println(list);
        TreeSet<Integer> set = new TreeSet<>(list);
       return set;
    }

}
